package com.hex.ds.hdrs.agent.converter;

import cn.hutool.core.date.DateUtil;
import com.hex.ds.hdrs.agent.po.AgentConf;
import com.hex.ds.hdrs.common.constant.Const;
import com.hex.ds.hdrs.common.utils.BaseUtil;
import com.hex.ds.ra.model.BizAgentModel;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

@Mapper(componentModel = "spring", imports = {BaseUtil.class, DateUtil.class})
public interface IAgentToBizAgentConverter {

    @Mappings({
            @Mapping(target = "agentCode",source = "agentCode"),
            @Mapping(target = "agentHost",source = "agentIp"),
            @Mapping(target = "agentPort",source = "agentPort"),
            @Mapping(target = "agentName",source = "agentName"),
            @Mapping(target = "version",source = "serverVer"),
            @Mapping(target = "appType",constant = Const.AGENT_NAME)
    })
    BizAgentModel toAgent(AgentConf agent);
}
